﻿<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" autoFlush="true"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<c:if test="${not empty usero}">
<span class="title1">用户信息</span>
<table class="its" cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
		<td width="14%" align="center">
		<table>
			<tr>
				<td align="center" colspan="2">
					<c:choose>
					<c:when test="${usero.headerImage == null}" >
					<img src="qa/images/header_default100.jpg" width="100" height="100">
					</c:when>
					<c:otherwise>
					<img src="<c:out value='header${usero.headerImage}'/>" width="100" height="100">
					</c:otherwise>
					</c:choose>
				</td>
			</tr>
			<tr>
				<td align="center">
				<c:if test="${not empty user_session}">
                <html:link href="javascript:sendMsg(this)">发送消息</html:link>
                </c:if><br>
                <c:if test="${user_session.type == '1' and user_session.isSuper == false}">
                    <c:if test="${usero.state == '1'}">
                        <c:url var="deleteUserUrl" value="/user.mrqa">
                            <c:param name="action" value="delete"/>
                            <c:param name="id" value="${param.id}"/>
                        </c:url>
                    </c:if>
                </c:if>
                <c:if test="${user_session.type == '1' or user_session.isSuper == true}">
                    <c:if test="${usero.state == '0'}">
                        <c:url var="prohibitUserUrl" value="/user.mrqa">
                            <c:param name="action" value="prohibit"/>
                            <c:param name="id" value="${param.id}"/>
                        </c:url>
                    </c:if>
                </c:if>
				</td>
			</tr>
		</table>
		</td>
		<td width="16%" align="center" height="100%">
		<table height="100%">
			<c:if test="${usero.isSuper}">
			<tr>
				<td align="right">他的职务：</td>
				<td align="left"><font color="blue">版主</font></td>
			</tr>
			</c:if>
			<c:if test="${usero.type == '1'}">
			<tr>
				<td align="right">他的职务：</td>
				<td align="left"><font color="green">管理员</font></td>
			</tr>
			</c:if>
			<tr>
				<td align="right">他的帖子：</td>
				<td align="left"><c:out value="${questionCount}" /></td>
			</tr>
			<tr>
				<td align="right">他的回复：</td>
				<td align="left"><c:out value="${answerCount}" /></td>
			</tr>
			<tr>
				<td align="right">他的资料：</td>
				<td align="left"><c:out value="${sfCount}" /></td>
			</tr>
			<tr>
				<td align="right">他的积分：</td>
				<td align="left"><c:out value="${usero.userMoney.totalMoney}" /></td>
			</tr>
		</table>
		</td>
		<td align="center" valign="middle"><img src="qa/images/user_center_sep.GIF"></td>
		<td align="center">
		<table height="100%" border="0" width="100%">
			<tr>
				<td width="14%" align="right">登录名：</td>
				<td width="41%"><c:out value="${usero.loginName}" /></td>
				<td align="right" width="14%">名称：</td>
				<td><c:out value="${usero.name}" /></td>
			</tr>
			<tr>
				<td align="right">注册时间：</td>
				<td>
					<fmt:formatDate value="${usero.registerDate}" var="registerDate" type="both" pattern="yyyy-MM-dd HH:mm:ss" />
					<c:out value="${registerDate}" />
				</td>
				<td align="right">最后登陆：</td>
				<td>
					<fmt:formatDate value="${usero.lastLoginDate}" var="lastLoginDate" type="both" pattern="yyyy-MM-dd HH:mm:ss" />
					<c:out value="${lastLoginDate}" />
				</td>
			</tr>
			<tr>
				<td align="right">个人经验：</td>
				<td><c:out value="${usero.userScore.totalScore}" /></td>
				<td align="right">个人头衔：</td>
				<td><c:out value="${usero.userScore.title}" /></td>
			</tr>
			<tr>
				<td align="right">电子邮件：</td>
				<td>
					<c:if test="${usero.isEmailPublic == true or user_session.type == '1'}">
						<c:out value="${usero.email}"/>
					</c:if>
				</td>
				<td align="right">联系电话：</td>
				<td><c:out value="${usero.mobile}" /></td>
			</tr>
			<tr>
				<td align="right">个人签名：</td>
				<td><c:out value="${usero.signature}" /></td>
				<td align="right"></td>
				<td></td>
			</tr>
			</table>
		</td>
	</tr>
    </table>
    <div id="sendMsgDiv" style="display:none;border:1 solid #ccc;">
    <html:form action="/msg" onsubmit="return msgValidate(this);">
        <input type="hidden" name="action" value="add"/>
        <input type="hidden" name="from" value="viewuserbyother"/>
        <input type="hidden" name="toUserId" value="<c:out value="${usero.id}"/>"/>
        <p>给<b><c:out value="${usero.loginName}"/></b>发送信息</p>
        <p>
            主题：<input type="text" name="title" value="<c:out value="${param.title}"/>" size="30" maxlength="30"/>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="submit" value="发送" name="submitButt"/>
        </p>
        <p>
            内容：<textarea name="content" rows="3" cols="50"><c:out value="${param.content}"/></textarea>(最多200字)
        </p>
    </html:form>
</c:if>
    <script type="text/javascript">
        <c:if test="${param.openMsgDiv == true}">
            var sendMsgDiv = document.getElementById("sendMsgDiv");
            sendMsgDiv.style.display = "block";
        </c:if>
        function sendMsg(pButton)
        {
            var sendMsgDiv = document.getElementById("sendMsgDiv");
            if(sendMsgDiv.style.display == "none")
            {
                sendMsgDiv.style.display = "block";
            }
            else
            {
                sendMsgDiv.style.display = "none";
            }
        }
        function msgValidate(pForm)
        {
            var title = pForm.title.value;
            if(title == "")
            {
                alert("[主题]必须大于6个字符！");
                pForm.title.focus();
                return false;
            }
            var content = pForm.content.value;
            if(content.length > 200)
            {
                alert("[内容]必须少于200个字！");
                return false;
            }
            pForm.submitButt.value = "正在发送...";
            pForm.submitButt.disabled = true;
            return true;
        }
    </script>
    </div>

